<?php

class User_Form_Signup extends Zend_Form
{

    public function init()
    {
        // Create a subform to hold all elements
        $form = new Zend_Form_SubForm();

        $name = new Koncept_Form_Element_Text('signup_name');
        $name->setLabel('Name')
            ->setDescription('Please enter your name')
            ->setRequired(true);

        $email = new Koncept_Form_Element_Email('signup_email');
        $email->setLabel('E-mail')
            ->setDescription('Please enter your e-mail address')
            ->setRequired(true);

        $content = new Zend_Form_Element_Textarea('signup_content');
        $content->setLabel('Content')
            ->setDescription('Put some content here')
            ->setRequired(true)
            ->setAttribs(array('rows' => 6, 'cols' => 50));

        $submit = new Zend_Form_Element_Submit('signup_submit');
        $submit->setLabel('Submit');

        $reset = new Zend_Form_Element_Reset('signup_reset');
        $reset->setLabel('Reset');

        $form->addElements(array($name, $email, $content, $submit, $reset));
        $form->addDisplayGroup(array('signup_submit', 'signup_reset'), 'buttons');

        $group = $form->getDisplayGroup('buttons');
        $group->setDecorators(array(
            array('FormElements'),
            array('HtmlTag', array('tag' => 'div',
                    'class' => 'formButtons')),
            array('DtDdWrapper'),
        ));
        // Put all elements into a subform to group them in an array on retrival
        $this->addSubForm($form, 'user');

        $this->setMethod('post')
            ->setAction('/user/signup')
            ->setName('signupform');
    }


}

